home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / os2 / wuz11a.zip / ZIPSTRIP.CMD < prev   
OS/2 REXX Batch file  |  1994-01-21  |  1KB  |  61 lines

  1. /* Compares current directory to zip file.          */
  2. /* Deletes files that no longer exist after confirmation. */
  3.  
  4. arg Name
  5. if Name='' then do
  6.   say "Usage: ZipStrip <zip-filename>"
  7.   say "Compares current directory to zip file."
  8.   say "Deletes files that no longer exist after confirmation."
  9.   exit(1)
  10. end
  11.  
  12. if LENGTH(CHARIN(Name,1,1)) \= 1 then do
  13.   say Name "not found."
  14.   exit(1)
  15. end
  16. call CharOut(Name)
  17.   
  18. '@unzip -v' Name '| rxqueue /fifo'
  19.  
  20. pull . . . . . . . FieldName .
  21. pull Underline
  22.  
  23. do i=1 to queued()
  24.   pull WholeLine
  25.   parse var WholeLine len . . . . . . File.i .
  26.   if len = '------' then
  27.     count = i-1
  28. end
  29. if Left(FieldName,4) \= "NAME" then do
  30.   say "I don't understand this format.  Name field's title is" FieldName
  31.   exit(1)
  32. end
  33.  
  34. z = 0
  35. do i=1 to count
  36.   if Length(CHARIN(File.i,1,1)) \= 1 then do
  37.     z = z+1
  38.     Deleted.z = File.i
  39.   end
  40. end
  41.  
  42. if z = count then do
  43.   say "None of the files in the archive exist.  Are you in the right directory?"
  44.   exit(1)
  45. end
  46.  
  47. if z>0 then do
  48.   DeleteList = ''
  49.   do i=1 to z
  50.     DeleteList = DeleteList Deleted.i
  51.   end
  52.   say "Preparing to remove:" DeleteList
  53.   Call CharOut ,"Okay? "
  54.   parse upper pull okay
  55.   if Left(okay,1)='Y' then do
  56.     '@zip -d' Name Strip(DeleteList)
  57.   end
  58.   else
  59.     say "Aborting ->" okay
  60. end
  61.